def select_sorted(li):
    for i in range(len(li)):
        # 记录值最小的位置
        min_local = i
        for j in range(i+1, len(li)):
            if li[min_local] > li[j]:
                min_local = j
        if min_local != i: # 只要不是他本身，就进行替换
            li[i], li[min_local] = li[min_local], li[i]



if __name__ == '__main__':
    l = [3, 4, 1, 5, 9, 2, 7, 8, ]
    select_sorted(l)
    print(l)
